#! /bin/sh
#
_TIME_Y=`date +%-Y`
_TIME_m=`date +%-m`
_TIME_d=`date +%-d`
_TIME_H=`date +%-H`
_TIME_M=`date +%-M`
_TIME_S=`date +%-S`
echo "#define _TIME_Y $_TIME_Y" >fat_config.h
echo "#define _TIME_m $_TIME_m" >>fat_config.h
echo "#define _TIME_d $_TIME_d" >>fat_config.h
echo "#define _TIME_H $_TIME_H" >>fat_config.h
echo "#define _TIME_M $_TIME_M" >>fat_config.h
echo "#define _TIME_S $_TIME_S" >>fat_config.h
echo "#define GET_FATTIME" >>fat_config.h
gcc -nostdlib -fno-zero-initialized-in-bss -fno-function-cse -fno-jump-tables -Wl,-N -fPIE fat.c ff.c -o fat.o
gcc -DFAT_MINI -nostdlib -fno-zero-initialized-in-bss -fno-function-cse -fno-jump-tables -Wl,-N -fPIE fat.c ff.c -o fatmini.o
objcopy -O binary fat.o fat
objcopy -O binary fatmini.o fatmini
rm fat*.o
gzip -9 fat fatmini
rename 's/\.gz$//' fat*.gz
date=`date -u +%Y-%m-%d`
zip -9 -r -q "../fat-$date.zip" fat fatmini